package com.gmail.dengtao.joe.group.packet;


/**
 * Message that is passed through the interceptor stack after the 
 * data serialized in the Channel object and then passed down to the 
 * interceptor and eventually down to the ChannelSender component
 * @author <a href="mailto:joe.dengtao@gmail.com">DengTao</a>
 * @version 1.0
 * @since 1.0
 */
public interface ChannelPacket {

	/**
	 * @return Length of this packet
	 * @since 1.0
	 */
	public int getLength();

	public void setData(byte[] data);
	
	/**
	 * Serializes the ChannelData object into a byte[] array
	 * @return
	 * @since 1.0
	 */
    public byte[] getData();
	
    /**
     * @return
     * @since 1.0
     */
    public byte[] toBytes();
    
    /**
     * Shallow clone, what gets cloned depends on the implementation
     * @return ChannelPacket
     */
    public Object clone();

    /**
	 * @return this packet's packet type
	 * @since 1.0
	 */
	int getType();

}
